package com.xiaoq.shop.entity;

import com.xiaoq.MongoEntity;
import com.xiaoq.coms.util.ConstantUtil;
import io.swagger.models.auth.In;
import org.mongodb.morphia.annotations.Entity;
import org.mongodb.morphia.annotations.Indexed;

import java.util.List;

/**
 * @author xinpeng created on 16/9/19-下午2:37.
 */

@Entity(value = "sku_collection" , noClassnameStored = true)
public class
SKUEntity extends MongoEntity {

    private String  shopId;

    @Indexed
    private String spuCode; //SPU编码

    private String spuName; //SPU名称（冗余存储）

    private String skuCode; //SKU编码

    private Long price;  //原始价格（在商品发布时设置）

    private Long discountPrice; //折扣价格（在限时折扣中设置）

    private Long recommendPrice; //店长推荐价格（在单品推荐中设置）

    private Integer stocks; //库存
    
    private String specifications; //规格,例如:"黑色;16G",多个规格用分号拼起来

    private String imageUrlOfSKU; //当前规格对应的产品图片url地址
    
    private Integer promotionState; //促销类型: 0原始价格,1微团购,2限时折扣,3店长推荐

    /**
     * 一次最大限购数量（门票里用。 0：不限购， 其他限购（多少张））
     */
    private Integer max2PermitPurchased;

    /**
     *门票-说明标签
     */
    private List<TicketTag> ticketLabels; //[1:16点前可购买今日门票，2:随时退]
    /**
     *门票-预定须知
     */
    private List<TicketTag> bookNotices;
    /**
     * 商品销售状态  1:上架中;0:已下架;
     */
    private Integer saleState;

    /**
     * 门票预售期（即可提前预定的天数）
     */
    private int preSalePeriod ;

	/**
	 * 平台发码（0：自有平台，1：第三方平台（如智游宝 等等））
	 */
    private String sellPlatform;
	/**
	 *  sellPlatform 为第三方平台才有的  第三方商品的 id
	 */
    private String sellPlatformGoodsId;

    /**
     * 讲解员ID
     */
    private String interpreterId;

    /**
     *  根据sortIndex排序,降序排序
     */
    private int sortIndex;

    //---------------以下是设定的微团购信息-----------------
    private double groupPurchasePrice; //团购价格（在微团购中设置）

    private int minimumQuantityRequired4OneGroup; //最小成团人数

    private int maxmumQuantityOfGroups;  //最大开团个数

    private Long startTime; //开始时间

    private Long endTime; //结束时间

    private boolean isRestrictedPurchaing; //是否限购

    private int maxmumQuantityToPermitPurchased; //在团购中每人允许的最大购买数量

    private int groupPurchaseState; //团购状态  1未开始  2 进行中 3已结束

    public String getShopId() {
		return shopId;
	}

	public void setShopId(String shopId) {
		this.shopId = shopId;
	}

	public String getSpuCode() {
		return spuCode;
	}

	public void setSpuCode(String spuCode) {
		this.spuCode = spuCode;
	}

	public String getSpuName() {
		return spuName;
	}

	public void setSpuName(String spuName) {
		this.spuName = spuName;
	}

	public String getSkuCode() {
		return skuCode;
	}

	public void setSkuCode(String skuCode) {
		this.skuCode = skuCode;
	}

	public Long getPrice() {
		return price;
	}

	public void setPrice(Long price) {
		this.price = price;
	}

	public Long getDiscountPrice() {
		return discountPrice;
	}

	public void setDiscountPrice(Long discountPrice) {
		this.discountPrice = discountPrice;
	}

	public Long getRecommendPrice() {
		return recommendPrice;
	}

	public void setRecommendPrice(Long recommendPrice) {
		this.recommendPrice = recommendPrice;
	}

	public Integer getStocks() {
		return stocks;
	}

	public void setStocks(Integer stocks) {
		this.stocks = stocks;
	}

	public String getSpecifications() {
		return specifications;
	}

	public void setSpecifications(String specifications) {
		this.specifications = specifications;
	}

	public String getImageUrlOfSKU() {
		return imageUrlOfSKU;
	}

	public void setImageUrlOfSKU(String imageUrlOfSKU) {
		this.imageUrlOfSKU = imageUrlOfSKU;
	}

	public Integer getPromotionState() {
		return promotionState;
	}

	public void setPromotionState(Integer promotionState) {
		this.promotionState = promotionState;
	}

	public Integer getMax2PermitPurchased() {
		return max2PermitPurchased;
	}

	public void setMax2PermitPurchased(Integer max2PermitPurchased) {
		this.max2PermitPurchased = max2PermitPurchased;
	}

	public List<TicketTag> getTicketLabels() {
		return ticketLabels;
	}

	public void setTicketLabels(List<TicketTag> ticketLabels) {
		this.ticketLabels = ticketLabels;
	}

	public List<TicketTag> getBookNotices() {
		return bookNotices;
	}

	public void setBookNotices(List<TicketTag> bookNotices) {
		this.bookNotices = bookNotices;
	}

	public Integer getSaleState() {
		return saleState;
	}

	public void setSaleState(Integer saleState) {
		this.saleState = saleState;
	}

	public int getPreSalePeriod() {
		return preSalePeriod;
	}

	public void setPreSalePeriod(int preSalePeriod) {
		this.preSalePeriod = preSalePeriod;
	}

	public String getInterpreterId() {
		return interpreterId;
	}

	public void setInterpreterId(String interpreterId) {
		this.interpreterId = interpreterId;
	}

	public int getSortIndex() {
		return sortIndex;
	}

	public void setSortIndex(int sortIndex) {
		this.sortIndex = sortIndex;
	}

	public double getGroupPurchasePrice() {
		return groupPurchasePrice;
	}

	public void setGroupPurchasePrice(double groupPurchasePrice) {
		this.groupPurchasePrice = groupPurchasePrice;
	}

	public int getMinimumQuantityRequired4OneGroup() {
		return minimumQuantityRequired4OneGroup;
	}

	public void setMinimumQuantityRequired4OneGroup(int minimumQuantityRequired4OneGroup) {
		this.minimumQuantityRequired4OneGroup = minimumQuantityRequired4OneGroup;
	}

	public int getMaxmumQuantityOfGroups() {
		return maxmumQuantityOfGroups;
	}

	public void setMaxmumQuantityOfGroups(int maxmumQuantityOfGroups) {
		this.maxmumQuantityOfGroups = maxmumQuantityOfGroups;
	}

	public Long getStartTime() {
		return startTime;
	}

	public void setStartTime(Long startTime) {
		this.startTime = startTime;
	}

	public Long getEndTime() {
		return endTime;
	}

	public void setEndTime(Long endTime) {
		this.endTime = endTime;
	}

	public boolean isRestrictedPurchaing() {
		return isRestrictedPurchaing;
	}

	public void setRestrictedPurchaing(boolean isRestrictedPurchaing) {
		this.isRestrictedPurchaing = isRestrictedPurchaing;
	}

	public int getMaxmumQuantityToPermitPurchased() {
		return maxmumQuantityToPermitPurchased;
	}

	public void setMaxmumQuantityToPermitPurchased(int maxmumQuantityToPermitPurchased) {
		this.maxmumQuantityToPermitPurchased = maxmumQuantityToPermitPurchased;
	}

	public int getGroupPurchaseState() {
		return groupPurchaseState;
	}

	public void setGroupPurchaseState(int groupPurchaseState) {
		this.groupPurchaseState = groupPurchaseState;
	}

	public enum GroupPurchaseState {
        
        NOT_START(1),  //未开始
        IN_PROGRESS(2), //进行中
        END(3), //已结束
        SET(9), //已设定团购
        ALL(99); //所有状态

        private int code;

        GroupPurchaseState(int code){
            this.code = code;
        }

        public int value(){
            return this.code;
        }
    }

	public String getSellPlatform() {
		return sellPlatform;
	}

	public void setSellPlatform(String sellPlatform) {
		this.sellPlatform = sellPlatform;
	}

	public String getSellPlatformGoodsId() {
		return sellPlatformGoodsId;
	}

	public void setSellPlatformGoodsId(String sellPlatformGoodsId) {
		this.sellPlatformGoodsId = sellPlatformGoodsId;
	}
}
